-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[pythonscripting] Fix python timedelta to java duration mapping #18671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I have proposed a small simplification, otherwise LGTM.
// picking two members to check as Duration has many common function names | ||
v -> v.hasMember("total_seconds") && v.hasMember("total_seconds"), | ||
v -> Duration.ofNanos(v.invokeMember("total_seconds").asLong() * 10000000), | ||
v -> Duration.ofNanos(v.invokeMember("total_seconds").asLong() * 1000000000), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v -> Duration.ofNanos(v.invokeMember("total_seconds").asLong() * 1000000000), | |
v -> Duration.ofSeconds(v.invokeMember("total_seconds").asLong()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another commit which fix the nano seconds accuracy and make it clear why we need "Duration.ofNanos"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…hab#18671) * fix python timedelta to java duration mapping * fix duration accuracy
…hab#18671) * fix python timedelta to java duration mapping * fix duration accuracy
This fixes the mapping between a python timedelta to java Duration mapping
@jlaur can you please review?